package org.lee.resbundle2;

import org.lee.resbundle2.res.Constants;

import java.util.Locale;
import java.util.ResourceBundle;

/**
 * ResourceBundleEx
 * 使用ListResourceBundle
 * @author dralee
 * @date 2021-12-28 15:33:31
 **/
public class ResourceBundleEx {
    public static void main(String[] args) {
        Locale locSk = new Locale("sk", "SK");
        output(locSk);

        Locale locCZ = new Locale("cs", "CZ");
        output(locCZ);

    }

    private static void output(Locale locale){
        ResourceBundle bundle = ResourceBundle.getBundle("org.lee.resbundle2.res.DocResources", locale);
        System.out.printf("Capital: %s %n", bundle.getObject(Constants.CAPITAL));
        System.out.printf("Area: %s %n", bundle.getObject(Constants.AREA));
        System.out.printf("Currency: %s %n", bundle.getObject(Constants.CURRENCY));
        System.out.println();
    }
}
